package org.example.fault.retry;

import org.example.serializer.Serializer;
import org.example.spi.SpiLoader;

/**
 * 序列化工厂(用于获取序列化器对象)
 */
public class RetryStrategyFactory {

    static {
        SpiLoader.load(RetryStrategy.class);
    }

    /**
     * 默认重试策略
     */
    private static final RetryStrategy DEFAULT_RETRY_STRATEGY = new NoRetryStrategy();

    /**
     * 获取实例
     * @param key
     * @return
     */
    public static RetryStrategy getInstance(String key) {
        System.out.println(Thread.currentThread().getName() + "执行RetryStrategyFactory中的getInstance方法");
        return SpiLoader.getInstance(RetryStrategy.class,key);
    }
}
